Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gpgpuimgui #707

Open
wants to merge 120 commits into
base: master
Choose a base branch
from
Open

Gpgpuimgui #707

wants to merge 120 commits into from

Conversation

devshgraphicsprogramming
Copy link
Member

Description

Testing

TODO list:

…pping into vertex shader - TODO: fill clipping plane distances
…ipeline barier to change the font image's layout after the buffer update from TRANSFER_DST_OPTIMAL to READ_ONLY_OPTIMAL
…ngine for this purpose with full test suite. Enter runtime issues, I think it's because of how I currently share resources across modules and the fact ImGUI context is static
Comment on lines 36 to 37
core::smart_refctd_ptr<video::IDescriptorPool> m_descriptorPool;
core::smart_refctd_ptr<video::IGPUDescriptorSet> m_gpuDescriptorSet;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are super weird to belong to ImGUI

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 26 to 29
smart_refctd_ptr<IGPUDescriptorSetLayout> UI::CreateDescriptorSetLayout()
smart_refctd_ptr<IGPUDescriptorSetLayout> UI::createDescriptorSetLayout()
{
nbl::video::IGPUDescriptorSetLayout::SBinding bindings[] = {
nbl::video::IGPUDescriptorSetLayout::SBinding bindings[] =
{
{
.binding = 0,
.binding = 0u,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as the user to provide a descriptor set layout, also as what binding Ix holds the textures we'll index

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

…ate memory corruption issues. Make NITE work, now we just need to take care of imguizmo which doesn't like the configuration
Comment on lines 399 to 403
void UI::createDescriptorPool()
{
static constexpr int TotalSetCount = 1;
IDescriptorPool::SCreateInfo createInfo = {};
createInfo.maxDescriptorCount[static_cast<uint32_t>(asset::IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER)] = TotalSetCount;
createInfo.maxDescriptorCount[static_cast<uint32_t>(asset::IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER)] = 1u;
createInfo.maxDescriptorCount[static_cast<uint32_t>(asset::IDescriptor::E_TYPE::ET_STORAGE_BUFFER)] = 1u;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user shall be in charge of this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

}
tQueue->endCapture();

auto & io = ImGui::GetIO();
io.DisplaySize = ImVec2(m_window->getWidth(), m_window->getHeight());
io.DisplayFramebufferScale = ImVec2(1.0f, 1.0f);

m_vertexBuffers.resize(maxFramesInFlight);
m_indexBuffers.resize(maxFramesInFlight);
m_mdiBuffers.resize(maxFramesInFlight);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when you'll use StreamingTransientDataBufferST for the mdiBuffer, you can forget about maxFramesInFlight

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 579 to 581
bool UI::render(IGPUCommandBuffer* commandBuffer, const uint32_t frameIndex)
{
const bool validFramesRange = frameIndex >= 0 && frameIndex < maxFramesInFlight;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using StreamingTransientDataBufferST for the mdi buffers will free you from having to ask for the frameIndex

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw also take SIntededSubmit instead of just commandBuffer then you'll be able to handle overflows nicely and also steal the signalSemaphores to latch the free of the mdiBuffer allocation upon a frame completion

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we agreed we remove SIntededSubmit from the render method due to overflow & non-dynamic renderpass issues

Comment on lines +661 to +662
core::vector2df_SIMD scale;
core::vector2df_SIMD translate;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use nbl::hlsl::float32_t2 types

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another PR

Comment on lines 902 to 903
VkRect2D scissor[] = { {.offset = {(int32_t)viewport.x, (int32_t)viewport.y}, .extent = {(uint32_t)viewport.width, (uint32_t)viewport.height}} };
commandBuffer->setScissor(scissor); // cover whole viewport (only to not throw validation errors)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just create a pipeline without any scissors (its in the pipeline creation parameters)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you cannot because currently we hardcode dynamic state - VK_DYNAMIC_STATE_SCISSOR as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ask user for the number of dynamic scissors that will be used for the Graphics Pipeline

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines +173 to +179
for (auto i = 0u; i < m_maxFramesInFlight; i++)
{
if (!m_cmdPool)
return logFail("Couldn't create Command Pool!");
if (!m_cmdPool->createCommandBuffers(IGPUCommandPool::BUFFER_LEVEL::PRIMARY, { m_cmdBufs.data() + i, 1 }))
return logFail("Couldn't create Command Buffer!");
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should probably create all commandbuffers at once

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we agreed to fix/update/adjust the nite in the next PR

Comment on lines +246 to +259
const auto resourceIx = m_realFrameIx % m_maxFramesInFlight;

if (m_realFrameIx >= m_maxFramesInFlight)
{
const ISemaphore::SWaitInfo cbDonePending[] =
{
{
.semaphore = m_semaphore.get(),
.value = m_realFrameIx + 1 - m_maxFramesInFlight
}
};
if (m_device->blockForSemaphores(cbDonePending) != ISemaphore::WAIT_RESULT::SUCCESS)
return;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think some surgery between two examples went wrong.

The new examples use m_submitIx to advance the semaphore each time the main render submission is done.

and here you're doing some sync based on m_realFrameIx instead

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we agreed to fix/update/adjust the nite in the next PR

…fig header on fly with CMake and share across imgui projects. TODO: add NBL_IMGUI_WITH_TEST_ENGINE enabled by default which makes all imgui projects use our configuration with embedding the test engine and enables the nite tool, otherwise disables stuff and limits the imgui build to minimum
…buffer themselves & validate its creation params, memory, allocate + mapping flags, update examples_tests submodule
… minimum (remove optional delta in secs, 1/60 by default), get rid of our IWindow & ICursor dependency from the UI, move ImGui::Render() from .update to .render, update examples_tests submodule
…ter multi_allocate, don't try to map MDI memory range in case its unmapped at .render
@@ -816,7 +816,7 @@ namespace nbl::ext::imgui

auto mdiBuffer = smart_refctd_ptr<IGPUBuffer>(m_mdi.streamingTDBufferST->getBuffer());
{
std::chrono::steady_clock::time_point timeout(std::chrono::seconds(0x45));
auto timeout(std::chrono::steady_clock::now() + std::chrono::seconds(1u));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still should be MILISECONDS

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

… required usage buffer flags, increase minStreamingBufferAllocationSize to 32u
…akes, also the design for the subscriber could be better however lets leave it currently
…the constructor, do also another clean-up, put stuff into nice creation parameters struct, remove unnecessary font adjusting static method + a few IO variables we were setting to their default values anyway, add more comments for users, update examples_tests submodule

struct S_CREATION_PARAMETERS
{
video::IUtilities* const utilities; //! required
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for image upload?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes+ I like the fact I already have device + logger there

…s deflate dependency, it should never look system wide but download
…ve NSC from the ImGUI extension build system & embed shader sources instead (leave some comments), codegen & compile shaders on fly with respect to new optional S_RESOURCE_PARAMETERS (leave user freedom to specify set & resource bindings with certain required constraints), add more validation to the UI creation, update examples_tests submodule
…XTURES_BINDING, NBL_SAMPLER_STATES_BINDING, NBL_RESOURCES_COUNT & NBL_RESOURCES_SET. Validate external descriptor set layout if given (redirects, validate required textures & samplers binding), support generating default one if nullptr passed. Add more comments for API usage, update examples_tests submodule
…recording non-dynamic renderpass - bring back command buffer + add semaphore wait info for deferred memory deallocation, clean more code, add comments regarding linear allocator TODO, update examples_tests submodule
…yout with pipeline layout in the creation parameters, update examples_tests submodule
…cator host allocator + LinearAddressAllocatorST sub-allocator combo & use allocator type traits to handle them, update examples_tests submodule, leave some TODO comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants